<template>
  <div class="dashboard-container">
    <h2>作用域插槽</h2>
    <hr>
    <ShowName first-name="tom" last-name="green" />
    <ShowName first-name="小明" last-name="王">
      <template v-slot="{info}">
        {{ info.lname+ ' '+info.fname }}
      </template>
    </ShowName>
    <hr>
    <el-table :data="list">
      <el-table-column label="姓名" prop="name" />
      <el-table-column label="年龄" prop="age" />
      <el-table-column label="性别" prop="gender">
        <template v-slot="{row}">
          {{ row.gender === 1? '男':'女' }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import ShowName from './components/ShowName.vue'
export default {

  name: 'Dashboard',
  components: { ShowName },
  data () {
    return {
      list: [
        {
          id: 1,
          name: '张三',
          age: 13,
          gender: 1
        },
        {
          id: 1,
          name: '李四',
          age: 13,
          gender: 2
        },
        {
          id: 1,
          name: '王五',
          age: 13,
          gender: 1
        }
      ]
    }
  }
}
</script>

<style lang="scss" scoped>
.eye-cls {
  color: blue;
}
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
